package com.dimong.www.loan.ui.adapter.holder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.dimong.loan.sdk.ui.adapter.BaseRecyclerViewHolder;
import com.dimong.loan.sdk.utils.UIUtils;
import com.dimong.www.loan.R;
import com.dimong.www.loan.bean.ClassifyBean;
import com.dimong.www.loan.utils.ViewUtils;

public class LoadRecommendItemHolder extends BaseRecyclerViewHolder {
    private View ll_item_item_load_recommend;
    private ImageView iv_item_item_load_recommend;
    private TextView tv_item_item_load_recommend;
    public LoadRecommendItemHolder(Context context, int resId, ViewGroup parent) {
        super(context, resId, parent);
        ll_item_item_load_recommend = itemView.findViewById(R.id.ll_item_item_load_recommend);
        iv_item_item_load_recommend = itemView.findViewById(R.id.iv_item_item_load_recommend);
        tv_item_item_load_recommend = itemView.findViewById(R.id.tv_item_item_load_recommend);
        ViewUtils.setViewParams(ll_item_item_load_recommend, UIUtils.getWidth() / 4, UIUtils.dipToPx(114));
    }

    @Override
    public void setData(Object object) {
        super.setData(object);
        if(object instanceof ClassifyBean){
            ClassifyBean classifyBean = (ClassifyBean) object;

            Glide.with(mContext).load(classifyBean.getClassify_logo()).into(iv_item_item_load_recommend);
            tv_item_item_load_recommend.setText(classifyBean.getClassify_name());
        }
    }
}
